/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * File Name          : freertos.c
  * Description        : Code for freertos applications
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2023 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Includes ------------------------------------------------------------------*/
#include "FreeRTOS.h"
#include "task.h"
#include "main.h"
#include "cmsis_os.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */

/* USER CODE END PTD */

/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */

/* USER CODE END PD */

/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */

/* USER CODE END PM */

/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN Variables */

/* USER CODE END Variables */
/* Definitions for LED_TASK */
osThreadId_t LED_TASKHandle;
const osThreadAttr_t LED_TASK_attributes = {
  .name = "LED_TASK",
  .stack_size = 128 * 4,
  .priority = (osPriority_t) osPriorityLow,
};
/* Definitions for Chassis_Task */
osThreadId_t Chassis_TaskHandle;
const osThreadAttr_t Chassis_Task_attributes = {
  .name = "Chassis_Task",
  .stack_size = 128 * 4,
  .priority = (osPriority_t) osPriorityAboveNormal,
};
/* Definitions for Judge_Unpack_Ta */
osThreadId_t Judge_Unpack_TaHandle;
const osThreadAttr_t Judge_Unpack_Ta_attributes = {
  .name = "Judge_Unpack_Ta",
  .stack_size = 128 * 4,
  .priority = (osPriority_t) osPriorityRealtime,
};
/* Definitions for LostCounterTask */
osThreadId_t LostCounterTaskHandle;
const osThreadAttr_t LostCounterTask_attributes = {
  .name = "LostCounterTask",
  .stack_size = 128 * 4,
  .priority = (osPriority_t) osPriorityLow,
};
/* Definitions for SuperCTask */
osThreadId_t SuperCTaskHandle;
const osThreadAttr_t SuperCTask_attributes = {
  .name = "SuperCTask",
  .stack_size = 128 * 4,
  .priority = (osPriority_t) osPriorityNormal,
};
/* Definitions for yawcommunicate_ */
osThreadId_t yawcommunicate_Handle;
const osThreadAttr_t yawcommunicate__attributes = {
  .name = "yawcommunicate_",
  .stack_size = 128 * 4,
  .priority = (osPriority_t) osPriorityHigh,
};
/* Definitions for StulnteractiveT */
osThreadId_t StulnteractiveTHandle;
const osThreadAttr_t StulnteractiveT_attributes = {
  .name = "StulnteractiveT",
  .stack_size = 128 * 4,
  .priority = (osPriority_t) osPriorityLow,
};
/* Definitions for PowerBufferTask */
osThreadId_t PowerBufferTaskHandle;
const osThreadAttr_t PowerBufferTask_attributes = {
  .name = "PowerBufferTask",
  .stack_size = 128 * 4,
  .priority = (osPriority_t) osPriorityLow,
};
/* Definitions for remotetask */
osThreadId_t remotetaskHandle;
const osThreadAttr_t remotetask_attributes = {
  .name = "remotetask",
  .stack_size = 128 * 4,
  .priority = (osPriority_t) osPriorityRealtime7,
};
/* Definitions for YawCommunicateBinarySem */
osSemaphoreId_t YawCommunicateBinarySemHandle;
const osSemaphoreAttr_t YawCommunicateBinarySem_attributes = {
  .name = "YawCommunicateBinarySem"
};
/* Definitions for AirComunicateBinarySem */
osSemaphoreId_t AirComunicateBinarySemHandle;
const osSemaphoreAttr_t AirComunicateBinarySem_attributes = {
  .name = "AirComunicateBinarySem"
};
/* Definitions for JudgeRecieiveBinarySem */
osSemaphoreId_t JudgeRecieiveBinarySemHandle;
const osSemaphoreAttr_t JudgeRecieiveBinarySem_attributes = {
  .name = "JudgeRecieiveBinarySem"
};
/* Definitions for RemoteSem */
osSemaphoreId_t RemoteSemHandle;
const osSemaphoreAttr_t RemoteSem_attributes = {
  .name = "RemoteSem"
};
/* Definitions for refereeEvent */
osEventFlagsId_t refereeEventHandle;
const osEventFlagsAttr_t refereeEvent_attributes = {
  .name = "refereeEvent"
};

/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN FunctionPrototypes */

/* USER CODE END FunctionPrototypes */

void Led_Task(void *argument);
void chassis_task(void *argument);
void judge_unpack_task(void *argument);
void lostcountertask(void *argument);
void superctask(void *argument);
void yawcommunicate_task(void *argument);
void StulnteractiveTask(void *argument);
void powerbuffertask(void *argument);
void RemoteTask(void *argument);

void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */

/**
  * @brief  FreeRTOS initialization
  * @param  None
  * @retval None
  */
void MX_FREERTOS_Init(void) {
  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* USER CODE BEGIN RTOS_MUTEX */
  /* add mutexes, ... */
  /* USER CODE END RTOS_MUTEX */

  /* Create the semaphores(s) */
  /* creation of YawCommunicateBinarySem */
  YawCommunicateBinarySemHandle = osSemaphoreNew(1, 0, &YawCommunicateBinarySem_attributes);

  /* creation of AirComunicateBinarySem */
  AirComunicateBinarySemHandle = osSemaphoreNew(1, 0, &AirComunicateBinarySem_attributes);

  /* creation of JudgeRecieiveBinarySem */
  JudgeRecieiveBinarySemHandle = osSemaphoreNew(1, 0, &JudgeRecieiveBinarySem_attributes);

  /* creation of RemoteSem */
  RemoteSemHandle = osSemaphoreNew(1, 0, &RemoteSem_attributes);

  /* USER CODE BEGIN RTOS_SEMAPHORES */
  /* add semaphores, ... */
  /* USER CODE END RTOS_SEMAPHORES */

  /* USER CODE BEGIN RTOS_TIMERS */
  /* start timers, add new ones, ... */
  /* USER CODE END RTOS_TIMERS */

  /* USER CODE BEGIN RTOS_QUEUES */
  /* add queues, ... */
  /* USER CODE END RTOS_QUEUES */

  /* Create the thread(s) */
  /* creation of LED_TASK */
  LED_TASKHandle = osThreadNew(Led_Task, NULL, &LED_TASK_attributes);

  /* creation of Chassis_Task */
  Chassis_TaskHandle = osThreadNew(chassis_task, NULL, &Chassis_Task_attributes);

  /* creation of Judge_Unpack_Ta */
  Judge_Unpack_TaHandle = osThreadNew(judge_unpack_task, NULL, &Judge_Unpack_Ta_attributes);

  /* creation of LostCounterTask */
  LostCounterTaskHandle = osThreadNew(lostcountertask, NULL, &LostCounterTask_attributes);

  /* creation of SuperCTask */
  SuperCTaskHandle = osThreadNew(superctask, NULL, &SuperCTask_attributes);

  /* creation of yawcommunicate_ */
  yawcommunicate_Handle = osThreadNew(yawcommunicate_task, NULL, &yawcommunicate__attributes);

  /* creation of StulnteractiveT */
  StulnteractiveTHandle = osThreadNew(StulnteractiveTask, NULL, &StulnteractiveT_attributes);

  /* creation of PowerBufferTask */
  PowerBufferTaskHandle = osThreadNew(powerbuffertask, NULL, &PowerBufferTask_attributes);

  /* creation of remotetask */
  remotetaskHandle = osThreadNew(RemoteTask, NULL, &remotetask_attributes);

  /* USER CODE BEGIN RTOS_THREADS */
  /* add threads, ... */
  /* USER CODE END RTOS_THREADS */

  /* Create the event(s) */
  /* creation of refereeEvent */
  refereeEventHandle = osEventFlagsNew(&refereeEvent_attributes);

  /* USER CODE BEGIN RTOS_EVENTS */
  /* add events, ... */
  /* USER CODE END RTOS_EVENTS */

}

/* USER CODE BEGIN Header_Led_Task */
/**
  * @brief  Function implementing the LED_TASK thread.
  * @param  argument: Not used
  * @retval None
  */
/* USER CODE END Header_Led_Task */
__weak void Led_Task(void *argument)
{
  /* USER CODE BEGIN Led_Task */
  /* Infinite loop */
  for(;;)
  {
    osDelay(1);
  }
  /* USER CODE END Led_Task */
}

/* USER CODE BEGIN Header_chassis_task */
/**
* @brief Function implementing the Chassis_Task thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_chassis_task */
__weak void chassis_task(void *argument)
{
  /* USER CODE BEGIN chassis_task */
  /* Infinite loop */
  for(;;)
  {
    osDelay(1);
  }
  /* USER CODE END chassis_task */
}

/* USER CODE BEGIN Header_judge_unpack_task */
/**
* @brief Function implementing the Judge_Unpack_Ta thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_judge_unpack_task */
__weak void judge_unpack_task(void *argument)
{
  /* USER CODE BEGIN judge_unpack_task */
  /* Infinite loop */
  for(;;)
  {
    osDelay(1);
  }
  /* USER CODE END judge_unpack_task */
}

/* USER CODE BEGIN Header_lostcountertask */
/**
* @brief Function implementing the LostCounterTask thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_lostcountertask */
__weak void lostcountertask(void *argument)
{
  /* USER CODE BEGIN lostcountertask */
  /* Infinite loop */
  for(;;)
  {
    osDelay(1);
  }
  /* USER CODE END lostcountertask */
}

/* USER CODE BEGIN Header_superctask */
/**
* @brief Function implementing the SuperCTask thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_superctask */
__weak void superctask(void *argument)
{
  /* USER CODE BEGIN superctask */
  /* Infinite loop */
  for(;;)
  {
    osDelay(1);
  }
  /* USER CODE END superctask */
}

/* USER CODE BEGIN Header_yawcommunicate_task */
/**
* @brief Function implementing the yawcommunicate_ thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_yawcommunicate_task */
__weak void yawcommunicate_task(void *argument)
{
  /* USER CODE BEGIN yawcommunicate_task */
  /* Infinite loop */
  for(;;)
  {
    osDelay(1);
  }
  /* USER CODE END yawcommunicate_task */
}

/* USER CODE BEGIN Header_StulnteractiveTask */
/**
* @brief Function implementing the StulnteractiveT thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_StulnteractiveTask */
__weak void StulnteractiveTask(void *argument)
{
  /* USER CODE BEGIN StulnteractiveTask */
  /* Infinite loop */
  for(;;)
  {
    osDelay(1);
  }
  /* USER CODE END StulnteractiveTask */
}

/* USER CODE BEGIN Header_powerbuffertask */
/**
* @brief Function implementing the PowerBufferTask thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_powerbuffertask */
__weak void powerbuffertask(void *argument)
{
  /* USER CODE BEGIN powerbuffertask */
  /* Infinite loop */
  for(;;)
  {
    osDelay(1);
  }
  /* USER CODE END powerbuffertask */
}

/* USER CODE BEGIN Header_RemoteTask */
/**
* @brief Function implementing the remotetask thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_RemoteTask */
__weak void RemoteTask(void *argument)
{
  /* USER CODE BEGIN RemoteTask */
  /* Infinite loop */
  for(;;)
  {
    osDelay(1);
  }
  /* USER CODE END RemoteTask */
}

/* Private application code --------------------------------------------------*/
/* USER CODE BEGIN Application */

/* USER CODE END Application */

